package common.lib.core;

import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import java.time.LocalDateTime;

/**
 * @author xiaozefeng
 * @date 2018-12-14 16:49
 */
@Getter
@Setter
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public class CRUDEntity extends UUIDEntity {

    /**
     * 创建时间
     */
    @Column(name = "created_time")
    @CreatedDate
    private LocalDateTime createdTime;

    /**
     * 更新时间
     */
    @Column(name = "updated_time")
    @LastModifiedDate
    private LocalDateTime updatedTime;

    /**
     * 创建人
     */
    @Column(name = "created_by")
    @CreatedBy
    private String createdBy;

    /**
     * 修改人
     */
    @Column(name = "updated_by")
    @LastModifiedBy
    private String updatedBy;

}
